package javabase.schoolwork.day6_10;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

/**
 * @author fance
 * @date 2018/6/10 14:41
 */
public class MyTask extends TimerTask {
    @Override
    public void run() {
        SimpleDateFormat simpleDateFormat =
                new SimpleDateFormat("yyyy-MM--dd");
        System.out.println(new Date());
    }


    public static void main(String[] args) {
        Timer timer = new Timer();
        MyTask myTask = new MyTask();
        timer.schedule(myTask,1000,2000);
    }
}
